package org.longgang.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.longgang.bean.Company;
import org.longgang.bean.User;
import org.springframework.stereotype.Repository;

/**
 * CompanyDAO继承基类
 */
@Repository
@Mapper
public interface CompanyDAO extends MyBatisBaseDao<Company, Integer> {
	
	@Select({"select * from company limit #{page},#{pages}"})
	List<Company> getCompanyAll(Integer page,Integer pages);
	
	@Insert({"insert into company(name,`password`,email) values (#{name}, #{password}, #{email})"})
	@Options(useGeneratedKeys = true, keyProperty = "companyid", keyColumn = "companyid")
	Integer insertCompany(Company info);
	
	@Select({"select * from company where email= #{email}"})
	Integer selectCompanyByEmail(Company info);
	
	@Select({"select * from company where name= #{name}"})
	Integer selectCompanyByName(Company info);
	
	@Select({ "select companyid from company where email= #{email} and `password`= #{password}" })
	Integer selectCompany(Company info);
	
	@Select({"select * from company where companyid= #{companyid}"})
	Company selectCompanyById(Company info);
}